package com.xdclass.intertupt;

/**
 * @Author: Timo
 * @Date: 2019/4/26 12:21
 * @Description: 中断,
 *
 */
public class InterruptDemo2 implements Runnable{

    private static volatile boolean FLAG = true;

    @Override
    public void run() {
        while (FLAG) {
            System.out.println(Thread.currentThread().getName());
        }

    }

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(new InterruptDemo2());
        t.start();
        Thread.sleep(2000L);
        FLAG = false;
    }




}
